<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        class Drag {
            //静态属性
            static height = '178';
            // 静态方法
            static test() {
                console.log('test..')
            }
            // 构造函数
            constructor(age) {
                this.name = '张三';
                this.age = age;
            }
            hobby() {
                console.log('篮球')
            }
            setStyle(){
                console.log('父类方法')
            }
        }
        // 继承父类
        class LimitDrag extends Drag {
            constructor(age) {
                super(age); //调用父类
            }
            setStyle(){
                super.setStyle(); //调取父类方法
                console.log('子类方法');
            }
        }

        let drag2 = new LimitDrag(18);
        console.log(drag2.age) //18
        //super.setStyle()之后可以使用父类方法进行增加功能
        drag2.setStyle() //父类方法 子类方法 

        //静态属性和方法绑定在类上面
        console.log(drag2.height) //undefined
        // drag2.test() //drag2.test is not a function

        console.log(LimitDrag.height) //178
        LimitDrag.test() //test..


    </script>

</body>

</html>